{include file="header"}
{php}
$isearch = request()->get('search',null);
{/php}
<script>
    var id = '{:request()->get("id")}';

    var table;
    layui.use(['table'],function () {
        table = layui.table;
    })
    function work_form(sel) {
        window.location.href="{:url('cartoon/details')}?search={$isearch}&id={:request()->get('id')}&sel="+sel
    }
    function dosearch() {
        $('#search').submit()
    }
    layui.use(['form'],function () {
        var form = layui.form
        form.on('select(search_type)', function(data){
            if(data.value=='year'){
                layer.open({
                    title:"按年份搜索",
                    type:1,
                    content:$('#searchforyear'),
                    btn: ['确定',],
                    success:function () {
                        layui.use(["form",'laydate'],function () {
                            var laydate = layui.laydate;
                            var form = layui.form;
                            form.on('radio(yeartype)', function(data2){

                                if(data2.value==1){
                                    $('#oneyearBox').show()
                                    $('#towyearBox').hide()
                                }else{
                                    $('#oneyearBox').hide()
                                    $('#towyearBox').show()
                                }
                            })
                            laydate.render({
                                elem:"#oneyear",
                                type:"year"
                            })
                            laydate.render({
                                elem:"#towyear",
                                type:"year"
                                ,range: true
                            })
                        })
                    },
                    yes:function () {
                        var yeartype = $('[name="yeartype"]:checked').val()

                        if(yeartype==1){
                            $('[name="year"]').val($('[name="oneyear"]').val())
                        }else{
                            $('[name="year"]').val($('[name="towyear"]').val())
                        }
                        dosearch()
                    }
                })
            }else if(data.value=='tdcyr'){
                layer.open({
                    title:"按参与人搜索",
                    type:1,
                    area: ['500px', '300px'],
                    content:$('#searchforstaff'),
                    btn: ['确定',],
                    success:function () {},
                    yes:function () {
                        var staff = [];
                        $('.stafflists').each(function () {
                            staff.push($(this).find('[name="staff"]').val())
                        })
                        $('#search').find('[name="staff"]').val(staff.join(","))
                        dosearch()
                    }
                })
            }else{
                dosearch()
            }
        });
    })
</script>
<style>
    .layui-card-body-table{
        overflow-x: scroll;
    }
    .layui-table .maxtd, .layui-table .maxth{
        min-width: 200px !important;
    }

</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title" >
                {foreach $work_form as $key=>$val}
                <li {if $sel eq $val}class="layui-this"{/if} onclick="work_form({$val})">{$work_form_arr[$val]}</li>
                {/foreach}
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    {switch $sel}
                    {case 1}{include file="cartoon/form/tv"}{/case}
                    {case 2}{include file="cartoon/form/comics"}{/case}
                    {case 3}{include file="cartoon/form/movie"}{/case}
                    {case 4}{include file="cartoon/form/ova"}{/case}
                    {/switch}
                </div>

            </div>
        </div>
    </div>
</div>
<div style="display: none;padding: 20px;" id="searchforyear">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <input type="radio" name="yeartype" lay-filter="yeartype" value="1" title="单年份" checked>
            <input type="radio" name="yeartype" lay-filter="yeartype" value="2" title="年份范围" >


        </div>
        <div class="layui-form-item" id="oneyearBox">
            <input type="text" name="oneyear" id="oneyear" class="layui-input" placeholder="单年份">

        </div>
        <div class="layui-form-item" id="towyearBox" style="display: none;">
            <input type="text" name="towyear" id="towyear" class="layui-input" placeholder="年份范围">

        </div>
    </form>

</div>
<div style="display: none;padding: 20px;" id="searchforstaff">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline staff_lists">
                <div class="layui-inline stafflists" data-cat="">
                    <input type="text" name="staff" value="" autocomplete="off" class="layui-input inline nosel" placeholder="请输入">
                </div>

            </div>
            <div class="layui-inline">
                <a href="javascript:;" class="layui-btn layui-btn-xs" onclick="addstaff()">添加</a>
                <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs" onclick="substaff()">删除</a>

            </div>
        </div>
    </form>
</div>
{include file="footer"}